import React from 'react'
import  './index.less'
export default class Child extends React.Component{
    constructor(props) {
        super(props);
        this.state = {
            date: new Date(),
            count:0,
            comment:'fdf'
        };
    }
    componentDidMount(){
        console.log('did mount')
    }

    componentWillUnmount(){
        console.log('will unmount')
    }

    componentWillReceiveProps(){
        console.log('will receive props')
    }

    shouldComponentUpdate(){
        console.log('Component Update')
        return true   // 默认为true ,若不为true 则子控件不能刷新
    }
    render(){

        return <div className="content">
            <div>这是子模块</div>
            <div>{this.props.name}</div>
        </div>
    }
}